package com.example.shushiyunsst.fragment.main.home.child.new_sale.chlid.bean;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.shushiyunsst.R;
import com.example.wallet.global.AppGlobals;

import java.io.Serializable;

public class SecKillSubBean implements Serializable {

   public final static String token_Type = AppGlobals.getApplication().getString(R.string.wallet_cml);

    /**
     * sid : 13
     * goodsId : 3
     * goodsLogo : http://162.247.99.201:81/shop/shop_top.jpg
     * goodsName : 俗世堂海参牡蛎复合肽
     * skpPrice : 88
     * skpPriceOld : 200
     * skpNums : 30
     * skpNumsSelled : 0
     * createTime : 2020-09-23 15:04:42
     * skpTimes : 10:00
     * skpDesc : 热卖抢购
     * goodsColor : {"color":[{"name":"大红色"},{"name":"绿色"}]}
     * goodsSize : {"size":[{"name":"XL"},{"name":"XLLL"}]}
     */

    @JSONField(name = "sid")
    private int sid;

    @JSONField(name = "goodsId")
    private int goodsId;

    @JSONField(name = "goodsLogo")
    private String goodsLogo;

    @JSONField(name = "goodsName")
    private String goodsName;

    @JSONField(name = "skpPrice")
    private int skpPrice;

    @JSONField(name = "skpPriceOld")
    private int skpPriceOld;

    @JSONField(name = "skpNums")
    private int skpNums;

    @JSONField(name = "skpNumsSelled")
    private int skpNumsSelled;

    @JSONField(name = "createTime")
    private String createTime;

    @JSONField(name = "skpTimes")
    private String skpTimes;

    @JSONField(name = "skpDesc")
    private String skpDesc;

    @JSONField(name = "goodsColor")
    private String goodsColor;

    @JSONField(name = "goodsSize")
    private String goodsSize;

    private String selectGoodsType = "规格";

    private int selectCount;

    private int allCostPrice;

    //支付方式
    private int payType = 0;

    public int getPayType() {
        return payType;
    }

    public void setPayType(int payType) {
        this.payType = payType;
    }

    public int getAllCostPrice() {
        return allCostPrice;
    }

    public String getAllCostPriceStr() {
        return allCostPrice + "\t" + token_Type;
    }

    public void setAllCostPrice(int allCostPrice) {
        this.allCostPrice = allCostPrice;
    }

    public int getSelectCount() {
        return selectCount;
    }

    public String getSelectCountStr() {
        return selectCount + "";
    }

    public void setSelectCount(int selectCount) {
        this.selectCount = selectCount;
        setAllCostPrice(selectCount * skpPrice);
    }

    public String getSelectGoodsType() {
        if (!haveGoodsType()) selectGoodsType = "";
        return goodsType();
    }

    public String goodsType() {
        return "颜色: " + goodsColor + " , 尺寸: " + goodsSize;
    }

    public boolean haveGoodsType() {
        return !TextUtils.isEmpty(goodsColor) || !TextUtils.isEmpty(goodsSize);
    }

    public void setSelectGoodsType(String selectGoodsType) {
        this.selectGoodsType = selectGoodsType;
    }

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public int getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(int goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsLogo() {
        return goodsLogo;
    }

    public void setGoodsLogo(String goodsLogo) {
        this.goodsLogo = goodsLogo;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public int getSkpPrice() {
        return skpPrice;
    }

    public String getSkpPriceStr() {

        return skpPrice + "\t" + token_Type;
    }

    public void setSkpPrice(int skpPrice) {
        this.skpPrice = skpPrice;
    }

    public int getSkpPriceOld() {
        return skpPriceOld;
    }

    public String getSkpPriceOldStr() {
        return skpPriceOld + "\t" + token_Type;

    }

    public void setSkpPriceOld(int skpPriceOld) {
        this.skpPriceOld = skpPriceOld;
    }

    public int getSkpNums() {
        return skpNums;
    }

    public String getSkpNumsStr() {
        return skpNums + "";
    }

    public void setSkpNums(int skpNums) {
        this.skpNums = skpNums;
    }

    public int getSkpNumsSelled() {
        return skpNumsSelled;
    }

    public void setSkpNumsSelled(int skpNumsSelled) {
        this.skpNumsSelled = skpNumsSelled;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getSkpTimes() {
        return skpTimes;
    }

    public void setSkpTimes(String skpTimes) {
        this.skpTimes = skpTimes;
    }

    public String getSkpDesc() {
        return skpDesc;
    }

    public void setSkpDesc(String skpDesc) {
        this.skpDesc = skpDesc;
    }

    public String getGoodsColor() {
        return goodsColor;
    }

    public void setGoodsColor(String goodsColor) {
        this.goodsColor = goodsColor;
    }

    public String getGoodsSize() {
        return goodsSize;
    }

    public void setGoodsSize(String goodsSize) {
        this.goodsSize = goodsSize;
    }

    public int progress() {
        int skpNumss = skpNumsSelled > 0 ? skpNums : 1;
        return (int) ((skpNumsSelled * 1.0f / skpNumss) * 100f);
    }
}
